package lab02.test06;

import static java.lang.StrictMath.sqrt;

public class Triangle {
    private double a;
    private double b;
    private double c;

    //无参构造
    public Triangle() {
    }

    //有参构造
    public Triangle(double a, double b, double c) {
        this.a = a;
        this.b = b;
        this.c = c;
    }

    //周长
    public double circumference() {
        return a + b + c;
    }

    //面积
    public double area() {
        double p = (a + b + c) / 2;
        return sqrt(p * (p - a) * (p - b) * (p - c));
    }

    public void change(double a, double b, double c) {
        this.a = a;
        this.b = b;
        this.c = c;
    }

    boolean judge() {
        if ((a + b) > c && (a - b) < c) {
            return true;
        } else {
            return false;
        }
    }
}
